#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/generate.h>
#include <thrust/sort.h>
#include <thrust/copy.h>
#include <algorithm>
#include <vector>
#include <time.h>

void __global__ docQueryScoringCoalescedMemoryAccessSampleKernel(thrust::device_vector<int>& h_vec) {
    // for(int i = 0; i < h_vec.size(); i++) {
        // printf("%d\n", h_vec[i]);
    // }
}
int main(void)
{
    thrust::host_vector<int> h_vec(1024*1024);
    std::generate(h_vec.begin(), h_vec.end(), rand);

    std::vector<int> vec(h_vec.size());
    thrust::copy(h_vec.begin(), h_vec.end(), vec.begin());

    thrust::device_vector<int> d_vec = vec;

    clock_t time1,time2;

    time1 = clock();
    thrust::sort(d_vec.begin(), d_vec.end());
    time2 = clock();
    std::cout<<(double)(time2-time1)/CLOCKS_PER_SEC<<std::endl;

    time1 = clock();
    std::sort(vec.begin(),vec.end());
    time2 = clock();
    std::cout<<(double)(time2-time1)/CLOCKS_PER_SEC<<std::endl;

    time1 = clock();
    docQueryScoringCoalescedMemoryAccessSampleKernel<<<1, 1>>>(d_vec);
    // thrust::sort(h_vec.begin(), h_vec.end());
    time2 = clock();
    std::cout<<(double)(time2-time1)/CLOCKS_PER_SEC<<std::endl;

    return 0;
}